package org.mcflier.appuntamento.io.driver.rss.imdb;

import java.util.Properties;
import java.util.logging.Logger;

import org.mcflier.appuntamento.core.Factory;
import org.mcflier.appuntamento.core.exception.ModulesException;
import org.mcflier.appuntamento.core.logger.LoggerManager;
import org.mcflier.appuntamento.data.model.ImdbList;
import org.mcflier.appuntamento.io.driver.rss.imdb.interfaces.IRssImdbDriver;
import org.mcflier.appuntamento.io.exception.RSSConnectionException;
import org.mcflier.appuntamento.io.exception.RSSParsingException;

public abstract class AbstractRssImdbDriver implements IRssImdbDriver {
	
	private Properties properties;
	protected Logger logger;
	
	public AbstractRssImdbDriver(){
		this.properties = null;
	}
	
	public void init(Properties properties) throws ModulesException{
		if(properties==null)
			throw new NullPointerException("Paramenter properties must not be null");
		
		this.properties = properties;
		this.logger = ((LoggerManager)Factory.getInstance().getModuleInstance(Factory.MODULE_LOGGER)).getLogger(this.getClass().getName());
	}
	
	protected Properties getProperties(){
		return this.properties;
	}

	@Override
	public abstract ImdbList getList(String link) throws RSSConnectionException, RSSParsingException;

	@Override
	public abstract ImdbList getListById(String idList) throws RSSConnectionException, RSSParsingException;
}
